﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.CF.Base;
using WoChu.RfClient.Entity;
using WoChu.RfClient.Duty.IFace;

namespace WoChu.RfClient.Duty
{
    public class LocationGoodsInventoryInfoUIRule
    {

        private static LocationGoodsInventoryInfoUIRule _NewInstance = new LocationGoodsInventoryInfoUIRule();

        public static LocationGoodsInventoryInfoUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new LocationGoodsInventoryInfoUIRule();
                }

                return _NewInstance;
            }
        }

        /// <summary>
        /// 获取商品货位库存
        /// </summary>
        /// <param name="locationCode"></param>
        /// <returns></returns>
        public ResultModel<List<LocationGoodsInventoryInfo>> GetLocationGoods(string code)
        {
            try
            {
                ResultModel<List<LocationGoodsInventoryInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoodsInventoryInfo>.NewInstance.InvokeWebMethod < ResultModel<List<LocationGoodsInventoryInfo>>>("GetLocationGoods", new object[] { code });
                if (_result == null)
                    return new ResultModel<List<LocationGoodsInventoryInfo>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<LocationGoodsInventoryInfo>>().GetInstance();
            }
 
        }

        /// <summary>
        /// 获取商品货位库存
        /// </summary>
        /// <param name="locationCode"></param>
        /// <returns></returns>
        public ResultModel<List<LocationGoodsInventoryInfo>> GetLocationGoodsByCode(string code)
        {
            try
            {
                ResultModel<List<LocationGoodsInventoryInfo>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoodsInventoryInfo>.NewInstance.InvokeWebMethod < ResultModel<List<LocationGoodsInventoryInfo>>>("GetLocationGoodsByCode", new object[] { code });
                if (_result == null)
                    return new ResultModel<List<LocationGoodsInventoryInfo>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<LocationGoodsInventoryInfo>>().GetInstance();
            }
           
        }

        /// <summary>
        /// 获取商品货位库存
        /// </summary>
        /// <param name="locationCode"></param>
        /// <returns></returns>
        public ResultModel<List<LocationGoodsInventoryDetail>> GetLocationGoodsByGoodsId(string goodsId)
        {
            try
            {
                ResultModel<List<LocationGoodsInventoryDetail>> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<ILocationGoodsInventoryInfo>.NewInstance.InvokeWebMethod < ResultModel<List<LocationGoodsInventoryDetail>>>("GetLocationGoodsByGoodsId", new object[] { goodsId });
                if (_result == null)
                    return new ResultModel<List<LocationGoodsInventoryDetail>>().GetInstance();
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
                return new ResultModel<List<LocationGoodsInventoryDetail>>().GetInstance();
            }
           
        }
    }

}
